const { STRING, BIGINT } = require("sequelize")
const seq = require("./seq")

// 定义模型
const User = seq.define("User", {
  username: {
    type: STRING,
    unique: true,
    allowNull: false,
    comment: "用户名，唯一"
  },
  password: {
    type: STRING,
    allowNull: false,
    comment: "密码"
  },
  avatar: {
    type: STRING,
    comment: "头像"
  },
  createdAt: {
    type: BIGINT,
    defaultValue: Date.now(),
    comment: "创建时间"
  }
}, {
  timestamps: false,
  underscored: true, // 驼峰命名转换为下划线
  // freezeTableName: true
})

// 发布模型
module.exports = User
